package com.api.mapper;

import com.api.pojo.HealthRecord;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface HealthRecordMapper {

    @Insert("insert into health_record(label, time) value(#{label}, #{time})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void create(HealthRecord hr);

    @Delete("delete from health_record where id = #{id}")
    void remove(Integer id);

    @Update("update health_record set label = #{label}, time = #{time} where id = #{id}")
    void update(HealthRecord healthRecord);

    @Select("select * from health_record limit #{pageNo}, #{pageSize}")
    List<HealthRecord> get(Integer pageNo, Integer pageSize);

    @Select("select count(*) from health_record")
    Integer count();

    @Select("select id from chamber")
    List<Integer> getChamberIds();
}
